require 'digest'

module Mil # :nodoc:
  # This module provides some utility methods useful
  # through out the system.
  module Utils
    # Generate a valid address from the passed object.
    def self.to_address(obj)
      Digest::SHA1.hexdigest(obj)
    end

    # Generate a Hexidecimal representation of the
    # address in string form.
    def self.from_address(str)
      str.unpack("H*")
    end
  end
end
